import java.util.Random;
import java.awt.*;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
import javax.swing.*;

import java.io.File;
import javax.imageio.*;
import java.io.*;
public class SetupWindow implements MouseMotionListener,MouseListener
{
 private int x, y;
 
 ImageIcon image1 = new ImageIcon("C:\\Users\\Zev\\Desktop\\BSetupWindow\\TwoSpacedShip.png");
  JPanel left,right,imageOne;
 JLabel label1;

 JButton done = new JButton("done");
 public SetupWindow()
 {
   
     makeContent();
 }
 public static void makeWindow()
 {
     
    JFrame window = new JFrame();
    window.setSize(400, 100);
    SetupWindow x = new SetupWindow();
    window.add(x.makeContent());
    window.setSize(1200,700);
    window.setVisible(true);
    window.repaint();
  
 }
    
 public JLayeredPane makeContent()
 {  
     left = new JPanel();
     left.setSize(150,450);
     left.setLocation(600,50);
     left.setBackground(Color.green);
     
     done.setLocation(left.getX()+75,left.getY()-30);
     
       
     label1 = new JLabel();
     label1.setSize(image1.getIconWidth(),image1.getIconHeight());
     label1.setIcon(image1);
   
     JPanel buttons = new JPanel();
     buttons.setBackground(Color.red);
     buttons.add(done);
     buttons.setSize(150,50);
     buttons.setLocation(600,450);
     label1.setLocation(left.getX()+ 50,60);
     label1.addMouseMotionListener(this);
     right = new JPanel();
     right.setBackground(Color.blue);
     right.setLocation(50,50);
     right.setSize(500,500);
    
     JLayeredPane layerDefine = new JLayeredPane();
     layerDefine.add(left, new Integer(0),1);
     layerDefine.add(right,new Integer(1),2);
     layerDefine.add(buttons,new Integer(2),2);
     layerDefine.add(label1, new Integer(3),0);
      
     return layerDefine;
}
 public void mouseClicked(MouseEvent e) { 
}
  public void mouseReleased(MouseEvent e) { }
  public void mouseEntered(MouseEvent e) { }
  public void mouseExited(MouseEvent e) { }
  public void mousePressed(MouseEvent e){}
  public void mouseMoved(MouseEvent e) { }
    
  public void mouseDragged(MouseEvent e) 
  {

   x = e.getXOnScreen()-50;
   y = e.getYOnScreen()-40;
   
   
   if(e.getSource() == label1)
        label1.setLocation(x,y);
  }
  
  public void loadPictures()
  {
    image1 = new ImageIcon("TwoSpacedShip.png");  
  }
   
  public static void main(String[] args)
  {
    makeWindow();
  }
}

